package com.wantup.dubbo.stub;

import com.wantup.dubbo.service.ServiceApi;

import java.util.List;

/**
 * @ClassName MyStub
 * @Description TODO
 * @Author zhaoluowei
 * @Date 2019/9/22  18:11
 * @Version 1.0
 */

public class MyStub implements ServiceApi {

    // 注入 prory 的 构造
    private final ServiceApi serviceApi;

    public MyStub(ServiceApi serviceApi) {
        this.serviceApi = serviceApi;
    }

    @Override
    public String sendMsg(String message) {
        System.out.println("sendMsg STUB : ");
        if (message.equalsIgnoreCase("123")) {
            return "抱歉，该值不被接受！！";
        }

        return serviceApi.sendMsg("stub messgae --> " + message);
    }

    @Override
    public String sendMsg02(String message) {
        System.out.println("sendMsg02 STUB: ");
        return serviceApi.sendMsg02(message);
    }

    @Override
    public List<String> mergerMsg(String message) {
        System.out.println("mergerMsg : ");
        return serviceApi.mergerMsg(message);
    }
}
